home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
OTHER_LA
/
YERK__
/
TOOLBOX_
/
CTLWIND
< prev
next >
Wrap
Text File
|
1990-11-25
|
3KB
|
91 lines
\ 1.3.88 rfl A window that will not scroll. This preserves the fprect
\ used by fwind for scrolling.
\ 11.25.90 rfl added close: feature to nonScrollWind. This means that
\ if selected and the window was from a resource, then
\ the global window position will be saved in the resource,
\ but the resource will not save to disk. Note that this
\ defaults to window's close method.
:CLASS nonScrollWind <super window
int savePosition
:M SAVEPOSITION: put: savePosition ;M
\ if the window was brought up from a resource, then save the last position
\ of the window in the resource, but don't save.
:M CLOSE: get: savePosition
IF set: self 0 l->g unpack \ get global corner
getRect: self put: tempRect
offset: tempRect get: tempRect
get: resID getres WIND -dup \ is there a resource?
IF >ptr put: rect THEN \ ok, so save the window coordinates
THEN
close: super ;M
\ ( -- ) Make this GrafPort current
:M SET: (abs) call SetPort ;M
\ ( -- ) update content area
:M DRAW: (abs) call BeginUpdate
savePort @xy set: self \ keep current fprect
exec: draw restport gotoxy \ call user draw routine
(abs) call EndUpdate ;M
;CLASS
\ ctlWind - Window subclass adding controls
\ 12/15/84 cbd Version 1
\ 9/04/86 ghs Fixed draw: -do draw: super first so controls are not erased
\ 12/04/87 rfl note that ' ctlproc is correct
\ 1/03/87 rfl super nonScrollWind
Decimal
\ ( part# ctlHndl -- ) execute action for control
: ctlExec exec: [ get-ctl-obj ] ;
\ procedure to be executed when a control is being tracked.
\ ( ctlHndl int:part -- )
:proc ctlProc word0 swap ctlExec ;proc
' ctlProc value ctp
\ Look for control click
: ctlHit? { wind \ part mpoint ^ctl action1 action2 -- bool }
where: fEvent g->l -> mpoint \ save mouse loc
Word0 mpoint wind +base
theCtl +base call FindControl
word0 -> part theCtl @ -> ^ctl \ ctl handle
part inThumb = part inCheckBox = or part inButton = or
IF 0 -> action1 'c ctlExec -> action2 \ only exec after release
ELSE ctp +base -> action1
'c 2drop -> action2
THEN ^ctl
IF word0 ^ctl mpoint action1
call TrackControl word0
^ctl exec> action2 true
ELSE false
THEN ;
\ Note: if your Window is a subclass of CtlWind and has scroll bars,
\ it should set the scroll bars to 255 hiliting on a deactivate event.
\ This can be done via the Disable: method in VScroll.
:CLASS CtlWind <Super NonScrollWind
\ draw the window with controls
:M DRAW: draw: super (abs) call DrawControls ;M
\ dispose of window's controls and close the window
:M CLOSE: (abs) call KillControls close: super ;M
\ handle a content click
:M CONTENT: active: self
IF ^base ctlHit? not
IF exec: content THEN
ELSE (abs) call SelectWindow
THEN
;M
;CLASS